﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RST
{
    public partial class Drugs:BaseRST
    {
        protected override Model.RST<T> GetRSTObject<T>(string Action, object Query)
        {
            return GetRSTObject<T>("Drugs", Action, Query);
        }


        public List<Model.Drugs> List(Model.Search.DrugsList dl)
        {
            Model.RST<List<Model.Drugs>> rsp = GetRSTObject<List<Model.Drugs>>("arraylist", dl);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }

        public bool Update(Model.Drugs Drugs)
        {
            Model.RST<int> rsp = GetRSTObject<int>("update", Drugs);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                if (rsp.RSTData > 0)
                    return true;
            }
            return false;
        }

        public Model.Drugs Insert(Model.Drugs Drugs)
        {
            Model.RST<Model.Drugs> rsp = GetRSTObject<Model.Drugs>("insert", Drugs);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }

        public bool Delete(Model.Drugs Drugs)
        {
            Model.RST<int> rsp = GetRSTObject<int>("delete", Drugs);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                if (rsp.RSTData > 0)
                {
                    return true;
                }
            }
            return false;
        }

        public Model.Drugs Single(Model.Drugs Drugs)
        {
            Model.RST<Model.Drugs> rsp = GetRSTObject<Model.Drugs>("single", Drugs);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }
    }
}
